<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
       	<%@include file ="../include/link.jsp"%> 
        <script language="javascript" type="text/javascript">
            //显示角色详细信息
            function showDetail(flag, a) {
                var detailDiv = a.parentNode.getElementsByTagName("div")[0];
                if (flag) {
                    detailDiv.style.display = "block";
                }
                else
                    detailDiv.style.display = "none";
            }
            function seek1(){
            	 var path = "${pageContext.request.contextPath}/service/ServiceListServlet";  
  			    $('#myform').attr("action", path).submit();; 
	            /* $.ajax({
	            	url:'${pageContext.request.contextPath}/service/ServiceListServlet',
	    			type:"post",
	    			data:$("#myform").serialize(),
	    			success:function(){
	    				target : '#myform';
	    				alert("chaxun");
	    				resetForm: true;
	    			}
	            }) */
            }
            //删除
            function deleteBuss(no) {
            	/*  var r = window.confirm("确定要删除此业务账号吗？删除后将不能恢复。");
                 document.getElementById("operate_result_info").style.display = "block"; */
 				$("#hi").val(no);
                $("#hi").attr("name","delete");
                var path = "${pageContext.request.contextPath}/service/DeleteServiceServlet";  
 			    $('#myform').attr("action", path).submit();; 
            }
          //修改
            function modifyBuss(no) {
 				$("#hi").val(no);
                $("#hi").attr("name","modify");
 				var path = "${pageContext.request.contextPath}/service/DeleteServiceServlet";  
 			    $('#myform').attr("action", path).submit();; 
            }
            //暂停
            function stopBuss(no) {
               /*  var r = window.confirm("确定要开通此账务账号吗？");
                document.getElementById("operate_result_info").style.display = "block"; */
 				$("#hi").val(no);
                $("#hi").attr("name","stop");
                var path = "${pageContext.request.contextPath}/service/DeleteServiceServlet";  
 			    $('#myform').attr("action", path).submit();; 
            }
            //开通
            function startBuss(no) {
               /*  var r = window.confirm("确定要开通此账务账号吗？");
                document.getElementById("operate_result_info").style.display = "block"; */
 				$("#hi").val(no);
                $("#hi").attr("name","start");
                var path = "${pageContext.request.contextPath}/service/DeleteServiceServlet";  
 			    $('#myform').attr("action", path).submit();; 
            }
            function addSelect() {                
  				$("#hi").val(no);
                $("#hi").attr("name","add");
 				var path = "${pageContext.request.contextPath}/service/DeleteServiceServlet";  
 			    $('#myform').attr("action", path).submit();; 
             }
        </script>
    </head>
    <body>
        <!--Logo区域开始-->
        <div id="header">
            <img src="../images/logo.png" alt="logo" class="left"/>
            <a href="#">[退出]</a>            
        </div>
        <!--Logo区域结束-->
        <!--导航区域开始-->
        <div id="navi">                        
            <ul id="menu">
                <%@include file ="../include/main.jsp"%>
            </ul>            
        </div>
        <!--导航区域结束-->
        <!--主要区域开始-->
        <div id="main">
            <form id="myform" action="${pageContext.request.contextPath}/service/DeleteServiceServlet" method="post">
            <%-- ${pageContext.request.contextPath}/service/DeleteServiceServlet --%>
                <!--查询-->
                <div class="search_add">                        
                    <div>OS 账号：<input type="text" name="os" class="width100 text_search" /></div>                            
                    <div>服务器 IP：<input type="text" name="ip" class="width100 text_search" /></div>
                    <div>身份证：<input type="text" name="card" class="text_search" /></div>
                    <div>状态：
                        <select name="state" class="select_search">
                            <option value="-2">全部</option>
                            <option value="1">开通</option>
                            <option value="0">暂停</option>
                            <option value="-1">删除</option>
                        </select>
                    </div>
                    <div><input type="button" id="seek" value="搜索" class="btn_search" onclick="seek1()"/></div>
                    <input type="button" value="增加" class="btn_add" onclick="addSelect();" />
                </div>  
                <!--删除的操作提示-->
                <div id="operate_result_info" class="operate_success">
                    <img src="../images/close.png" onclick="this.parentNode.style.display='none';" />
                    删除成功！
                </div>   
                <!--数据区域：用表格展示数据-->     
                <div id="data">            
                    <table id="datalist">
                    <tr>
                        <th class="width50">业务ID</th>
                        <th class="width70">账务账号ID</th>
                        <th class="width150">身份证</th>
                        <th class="width70">姓名</th>
                        <th>OS 账号</th>
                        <th class="width50">状态</th>
                        <th class="width100">服务器 IP</th>
                        <th class="width100">资费</th>                                                        
                        <th class="width200"></th>
                    </tr>
                    <c:forEach items="${lb}" var="lb">
                    <tr>
                        <td><a href="${pageContext.request.contextPath}/service/DetailServiceServlet?bus_no=${lb.bus_no}" title="查看明细">${lb.bus_no}</a></td>
                        <td>${lb.bus_ano}</td>
                        <td>${lb.bus_card}</td>
                        <td>${lb.bus_name}</td>
                        <td>${lb.bus_os}</td>
                        <td>
                        	<c:if test="${lb.bus_state==1}">开通</c:if>   
                        	<c:if test="${lb.bus_state==0}">暂停</c:if>
                        	<c:if test="${lb.bus_state==-1}">删除</c:if>  
                         </td>
                        <td>${lb.bus_ip}</td>
                        <td>
                            <a class="summary"  onmouseover="showDetail(true,this);" onmouseout="showDetail(false,this);">${lb.bus_taname}</a>
                            <!--浮动的详细信息-->
                            <div class="detail_info">
                            ${lb.tar_comm}
                            </div>
                        </td>                                                
                        <td class="td_modi">
	                         <c:if test="${lb.bus_state==1}"> 
	                            <input type="button" value="暂停" class="btn_pause"  onclick="stopBuss(${lb.bus_no})" />
	                            <input type="button" value="修改" class="btn_modify" onclick="modifyBuss(${lb.bus_no})" />
	                            <input type="button" value="删除" class="btn_delete" onclick="deleteBuss(${lb.bus_no})" />
	                       	 </c:if> 
	                         <c:if test="${lb.bus_state==0}">                         
	                            <input type="button" value="开通" class="btn_start" onclick="startBuss(${lb.bus_no})" />
	                            <input type="button" value="修改" class="btn_modify" onclick="modifyBuss(${lb.bus_no})" />
	                            <input type="button" value="删除" class="btn_delete" onclick="deleteBuss(${lb.bus_no})" />
	                         </c:if>
                        </td>
                       <input type="hidden" id="hi" name="" value=""/>                     
                    </tr>
                    </c:forEach>                                       
                </table>                
                <p>业务说明：<br />
                1、创建即开通，记载创建时间；<br />
                2、暂停后，记载暂停时间；<br />
                3、重新开通后，删除暂停时间；<br />
                4、删除后，记载删除时间，标示为删除，不能再开通、修改、删除；<br />
                5、业务账号不设计修改密码功能，由用户自服务功能实现；<br />
                6、暂停和删除状态的账务账号下属的业务账号不能被开通。</p>
                </div>                    
                <!--分页-->
                <div id="pages">
                    <a href="#">首页</a>
        	        <a href="#">上一页</a>
                    <a href="#" class="current_page">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                    <a href="#">4</a>
                    <a href="#">5</a>
                    <a href="#">下一页</a>
                    <a href="#">末页</a>
                </div>                    
            </form>
        </div>
        <!--主要区域结束-->
        <div id="footer">
           
        </div>
    </body>
</html>